@extends('layouts.admin')

@section('css')

@endsection

@section('content')
    <section class="content" id="app">
        <div class="box">
            <div class="box-body">
                <h1 v-text="message"></h1>

                <form>
                    <div class="form-group">

                    </div>
                </form>
            </div>
        </div>
    </section>
@endsection

@section('script')
    <script type="text/javascript">

        require(['Vue', 'VueResource'], function (Vue, VueResource) {
            Vue.use(VueResource)
            var app = new Vue({
                el: '#app',
                data: {
                    message: 'Hello Vue!'
                },
                methods: {
                    verify: function (state) {
                        verifyTask(state);
                    }
                }
            })
            // 审批任务
            function verifyTask(state) {
                var data = {
                    state: state
                }
                app.$http.post("/admin/task/save", data, {headers: header()})
                        .then(function (response) {
                            var json = response.body;
                            alert(json.msg);
                            if (json.state == 1) {
                                window.location.reload();
                            }
                        }).catch(function (response) {
                            console.log(response)
                        })
            }
        })

    </script>
@endsection